﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Com.Web.coffinegurunaru.AppLogic.Page;
using Com.Framework;
using Com.Library.DB.Board;
using Com.Library.DB.PageAuth;
using Com.Library.DB.Manager;

namespace Com.Web.coffinegurunaru.manager.board
{
	public partial class article4 : ManagerPage
	{
		public int BoardSN { get; set; }
		public int CategoryNo { get; set; }
		public List<PageAuthSubEntity> PageAuthSubList { get; set; }
		public byte IsManager = 0;

		protected void Page_Load(object sender, EventArgs e)
		{
			BoardSN = Request["boardSN"].Parse((int)0);
			CategoryNo = Request["CategoryNo"].Parse((int)100);

			PageAuthSubList = PageAuthModel.PageAuthSubList(this.WebCookies.ManagerSN, 1000);
			IsManager = ManagerModel.GetInfo(this.WebCookies.ManagerSN, this.WebCookies.ManagerID).IsManager;
		}

		public bool IsCategoryCheck(int CategoryType)
		{
			if (IsManager == 1)
				return true;

			foreach (var item in PageAuthSubList)
			{
				if (item.SubPageType == CategoryType)
				{
					return item.CodeAuthType == 1 ? true : false;
				}
			}

			return false;
		}
	}
}
